namespace IAM.Interface.Common.Abnormity
{
    using System;

    public class ResponseException : Exception
    {
        private string _message;
        private int _statuscode;

        public ResponseException()
        {
            this._message = "";
            this.StatusCode = 200;
        }

        public ResponseException(int statuscode)
        {
            this._message = "";
            this.StatusCode = statuscode;
        }

        public void SetStateMessage(int statuscode, string message)
        {
            this._statuscode = statuscode;
            this._message = message;
        }

        public override string Message
        {
            get
            {
                return this._message;
            }
        }

        public int StatusCode
        {
            get
            {
                return this._statuscode;
            }
            set
            {
                this._statuscode = value;
                switch (this._statuscode)
                {
                    case 100:
                        this._message = "正在处理。";
                        break;

                    case 200:
                        this._message = "请求的所有数据都处理成功";
                        break;

                    case 0xce:
                        this._message = "部分数据成功，不影响整体逻辑处理";
                        break;

                    case 400:
                        this._message = "请求格式不符合规范或服务器无法解析";
                        break;

                    case 0x191:
                        this._message = "该接口需要用户认证，请求消息未通过权限认证";
                        break;

                    case 0x194:
                        this._message = "需要处理的请求数据不存在";
                        break;

                    case 0x198:
                        this._message = "请求处理超时";
                        break;

                    case 410:
                        this._message = "某些特定错误，具体错误信息可以在详细的接口参数中体现";
                        break;

                    case 0x19e:
                        this._message = "请求地址不存在或没有回应";
                        break;

                    case 0x1a2:
                        this._message = "不安全的请求";
                        break;

                    case 500:
                        this._message = "服务器遇到了意想不到的情况，无法满足要求";
                        break;

                    case 600:
                        this._message = "员工不存在";
                        break;

                    case 710:
                        this._message = "请求超时";
                        break;

                    case 800:
                        this._message = "GUID验证重复";
                        break;

                    case 610:
                        this._message = "权限模型错误";
                        break;

                    case 700:
                        this._message = "签名不一致";
                        break;
                }
            }
        }
    }
}

